package com.gaohe.controller;

import com.gaohe.common.Result;
import com.gaohe.pojo.Shopkeeper;
import com.gaohe.pojo.VO.KaiDianVo;
import com.gaohe.service.ShopkeeperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/shopkeeper")
public class ShopkeeperController {
    @Autowired
    private ShopkeeperService shopkeeperService;
    @PostMapping("/kaidian")
    public Result kaiDian(@RequestBody KaiDianVo kaiDianVo){
        return shopkeeperService.kaiDian(kaiDianVo);
    }

    @GetMapping("/{shopkeeperId}")
    public Result getShopkeeperById(@PathVariable("shopkeeperId")Long shopkeeperId){
        Shopkeeper shopkeeper = shopkeeperService.getById(shopkeeperId);
        return Result.success(shopkeeper);
    }
}
